package com.xiaoshuidi.cloud.module.bpm.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum CustomeSourceEnum {
    UNLIMITED("不限", "1"),
    SAAS("saas", "2"),
    INCOMING_CALL("来电", "3"),
    CITY58("58同城", "4"),
    GO_TO_MARKET("赶集网", "5"),
    WEBSITE_ENTRUST("官网委托", "6"),
    WECHAT("微信", "7"),
    VISITORS("自来客", "8"),
    REFERRALS("转介绍", "9"),
    MEDIATOR("中介", "10"),
    FANG_TIAN_XIA("房天下", "11"),
    DOU_BAN("豆瓣", "12"),
    PEOPLE_NETWORK("百姓网", "13"),
    SALTED_FISH("咸鱼", "14"),
    WEI_BO("微博", "15"),
    WEBSITE_ONLINE("官网在线", "16"),
    OPERATIONS_MANAGEMENT("运营管理", "17"),
    OTHERS("其他", "18");

    private String name;
    private String value;

    public static String getNameByValue(String value){
        CustomeSourceEnum customeSourceEnum = Arrays.stream(CustomeSourceEnum.values()).filter(p -> p.getValue().equals(value)).findFirst().orElse(null);
        if(ObjectUtil.isEmpty(customeSourceEnum)){
            return "";
        }
        return customeSourceEnum.getName();
    }
}
